package com.bw.park2301.user

import androidx.lifecycle.MutableLiveData
import com.bw.lib_base.entity.UserBean
import com.bw.lib_base.mvvm.BaseViewModel
import com.bw.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class UserViewModel @Inject constructor(val apiService: ApiService): BaseViewModel() {
    //返回的结果
    val registerData = MutableLiveData<UserBean>()

    fun register(password: String, username: String){
        httpRequest({apiService.register(password, username)},registerData::postValue)
    }

    val loginData = MutableLiveData<UserBean>()

    fun login(password: String, username: String){
        httpRequest({apiService.login(password, username)},loginData::postValue)
    }
}